{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from pyreadstat import pyreadstat\n",
    "from pandas.api.types import CategoricalDtype\n",
    "import scipy.stats as stats\n",
    "import statsmodels.api as sm\n",
    "import plotly.express as px\n",
    "import mytools"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "df1,metadata = mytools.read_spss(R\"data\\大学生对于开屏广告的态度.sav\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "## 数据清理\n",
    "### 查看所有空白值\n",
    "temp = df1[df1.isnull().T.any()]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "16      124.119.69.67(新疆-伊犁)\n",
       "41     116.178.42.218(新疆-哈密)\n",
       "55     61.178.103.144(甘肃-兰州)\n",
       "76     61.178.103.144(甘肃-兰州)\n",
       "90     61.178.103.146(甘肃-兰州)\n",
       "94      210.26.15.146(甘肃-兰州)\n",
       "112    39.144.210.110(甘肃-兰州)\n",
       "113    61.178.103.140(甘肃-兰州)\n",
       "118    61.178.103.141(甘肃-兰州)\n",
       "127      42.88.166.65(甘肃-陇南)\n",
       "135    61.178.223.215(甘肃-兰州)\n",
       "141     42.63.135.72(宁夏-石嘴山)\n",
       "147    61.178.103.141(甘肃-兰州)\n",
       "193    61.178.103.149(甘肃-兰州)\n",
       "196    61.178.103.144(甘肃-兰州)\n",
       "204     39.144.227.84(贵州-铜仁)\n",
       "226    61.178.223.217(甘肃-兰州)\n",
       "230    61.178.103.140(甘肃-兰州)\n",
       "231     210.26.15.139(甘肃-兰州)\n",
       "240     42.63.135.72(宁夏-石嘴山)\n",
       "244    36.142.181.101(甘肃-兰州)\n",
       "258    61.178.223.210(甘肃-兰州)\n",
       "259     36.142.178.31(甘肃-兰州)\n",
       "291    61.178.103.143(甘肃-兰州)\n",
       "297     210.26.15.149(甘肃-兰州)\n",
       "298    61.178.103.149(甘肃-兰州)\n",
       "333     223.73.66.167(广东-广州)\n",
       "371     223.73.66.174(广东-广州)\n",
       "378     223.73.66.186(广东-广州)\n",
       "407     223.73.66.157(广东-广州)\n",
       "420    116.178.42.218(新疆-哈密)\n",
       "428    117.188.10.173(贵州-贵阳)\n",
       "429    117.188.10.173(贵州-贵阳)\n",
       "430    117.188.10.173(贵州-贵阳)\n",
       "Name: 来自IP, dtype: object"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 查看重复值\n",
    "df1[df1['来自IP'].duplicated()]['来自IP']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 删除重复值\n",
    "df2 = df1.drop_duplicates(subset=['来自IP'],keep='first')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "## 重命名变量名\n",
    "### 重命名变量\n",
    "df3 = df2.rename(columns={\n",
    "    '@1、您的性别': '性别',\n",
    "    '@2、您每天使用手机的频率': '每天手机使用频率',\n",
    "    '@3、您最常遇到开屏广告的APP类型是？':'最常接触开屏广告的APP类型',\n",
    "    '@4、您一天内在手机APP上看到开屏广告的次数是':'日均接触开屏广告次数',\n",
    "    '@5、您对哪类APP中的开屏广告更感兴趣？':'开屏广告类型偏好',\n",
    "    '@6、遇到APP开屏广告时，您的习惯一般是':'开屏广告操作习惯',\n",
    "    '@7、您对APP开屏广告的态度是':'开屏广告态度',\n",
    "    '@8、您觉得多长时间的开屏广告能接受？':'开屏广告接收时长',\n",
    "    '@9、您对APP开屏广告所表达的产品品牌活动信息':'开屏广告受众自评感知效果1',\n",
    "    '@10、您对手机APP开屏广告的内容印象程度是':'开屏广告受众自评感知效果2',\n",
    "    '@11、哪一类的开屏广告会吸引您的注意？【多选':'有效开屏广告特征',\n",
    "    '@12、您是否通过APP开屏广告主动接触其介绍的产':'开屏广告受众自评行动效果',\n",
    "    '@13、您认为APP开屏广告存在哪些问题？':'开屏广告存在问题',\n",
    "    '@14、开屏广告是否影响了您的正常浏览体验':'开屏广告浏览体验',\n",
    "    '@15、您认为每个APP开屏广告每天出现的次数最好':'开屏广告建议次数',\n",
    "    '@16、您觉得开屏广告的时间最好控制在':'开屏广告建议时长',\n",
    "    '@17、您认为APP开屏广告是否侵犯了您的隐私（如':'开屏广告隐私侵犯感',\n",
    "    '@18、您认为开屏广告中的关闭键设置是否合理':'开屏广告关闭键评价',\n",
    "    '@19、关于开屏广告的关闭键设置，您认为以下哪':'开屏广告关闭键改进建议',\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 必要的数据转换\n",
    "df3['填写问卷时长'] = df3['所用时间'].str.rstrip('秒')\n",
    "df3['日均接触开屏广告次数'] = df3['日均接触开屏广告次数'].str.strip('○')\n",
    "df3['开屏广告受众自评感知效果2'] = df3['开屏广告受众自评感知效果2'].str.strip('○')\n",
    "df3['开屏广告建议次数'] = df3['开屏广告建议次数'].str.strip('○')\n",
    "df3['开屏广告建议时长'] = df3['开屏广告建议时长'].str.strip('○')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>序号</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>提交答卷时间</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>所用时间</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来源</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来源详情</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来自IP</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>性别</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>每天手机使用频率</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>最常接触开屏广告的APP类型</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日均接触开屏广告次数</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告类型偏好</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告操作习惯</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告态度</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告接收时长</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告受众自评感知效果1</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告受众自评感知效果2</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>有效开屏广告特征</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告受众自评行动效果</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告存在问题</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告浏览体验</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告建议次数</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告建议时长</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告隐私侵犯感</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告关闭键评价</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告关闭键改进建议</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>填写问卷时长</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     0\n",
       "序号              object\n",
       "提交答卷时间          object\n",
       "所用时间            object\n",
       "来源              object\n",
       "来源详情            object\n",
       "来自IP            object\n",
       "性别              object\n",
       "每天手机使用频率        object\n",
       "最常接触开屏广告的APP类型  object\n",
       "日均接触开屏广告次数      object\n",
       "开屏广告类型偏好        object\n",
       "开屏广告操作习惯        object\n",
       "开屏广告态度          object\n",
       "开屏广告接收时长        object\n",
       "开屏广告受众自评感知效果1   object\n",
       "开屏广告受众自评感知效果2   object\n",
       "有效开屏广告特征        object\n",
       "开屏广告受众自评行动效果    object\n",
       "开屏广告存在问题        object\n",
       "开屏广告浏览体验        object\n",
       "开屏广告建议次数        object\n",
       "开屏广告建议时长        object\n",
       "开屏广告隐私侵犯感       object\n",
       "开屏广告关闭键评价       object\n",
       "开屏广告关闭键改进建议     object\n",
       "填写问卷时长          object"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 变量类型检查\n",
    "\"\"\"查看变量类型\"\"\"\n",
    "df3.dtypes.to_frame()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count     403\n",
       "unique    170\n",
       "top        83\n",
       "freq        8\n",
       "Name: 填写问卷时长, dtype: object"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3['填写问卷时长'].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>序号</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>提交答卷时间</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>所用时间</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来源</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来源详情</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来自IP</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>性别</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>每天手机使用频率</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>最常接触开屏广告的APP类型</th>\n",
       "      <td>string</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日均接触开屏广告次数</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告类型偏好</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告操作习惯</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告态度</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告接收时长</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告受众自评感知效果1</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告受众自评感知效果2</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>有效开屏广告特征</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告受众自评行动效果</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告存在问题</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告浏览体验</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告建议次数</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告建议时长</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告隐私侵犯感</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告关闭键评价</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告关闭键改进建议</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>填写问卷时长</th>\n",
       "      <td>int32</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                       0\n",
       "序号                object\n",
       "提交答卷时间            object\n",
       "所用时间              object\n",
       "来源                object\n",
       "来源详情              object\n",
       "来自IP              object\n",
       "性别              category\n",
       "每天手机使用频率        category\n",
       "最常接触开屏广告的APP类型    string\n",
       "日均接触开屏广告次数      category\n",
       "开屏广告类型偏好        category\n",
       "开屏广告操作习惯        category\n",
       "开屏广告态度          category\n",
       "开屏广告接收时长        category\n",
       "开屏广告受众自评感知效果1   category\n",
       "开屏广告受众自评感知效果2   category\n",
       "有效开屏广告特征        category\n",
       "开屏广告受众自评行动效果    category\n",
       "开屏广告存在问题        category\n",
       "开屏广告浏览体验        category\n",
       "开屏广告建议次数        category\n",
       "开屏广告建议时长        category\n",
       "开屏广告隐私侵犯感       category\n",
       "开屏广告关闭键评价       category\n",
       "开屏广告关闭键改进建议     category\n",
       "填写问卷时长             int32"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"\"\"设定变量类型\"\"\"\n",
    "df4 = df3.astype({\n",
    "    '性别': 'category',\n",
    "    '填写问卷时长': 'int',\n",
    "    '每天手机使用频率': 'category',\n",
    "    '最常接触开屏广告的APP类型': 'string',\n",
    "    '日均接触开屏广告次数': 'category',\n",
    "    '开屏广告类型偏好': 'category',\n",
    "    '开屏广告操作习惯': 'category',\n",
    "    '开屏广告态度': 'category',\n",
    "    '开屏广告接收时长': 'category',\n",
    "    '开屏广告受众自评感知效果1': 'category',\n",
    "    '开屏广告受众自评感知效果2': 'category',\n",
    "    '有效开屏广告特征': 'category',\n",
    "    '开屏广告受众自评行动效果': 'category',\n",
    "    '开屏广告存在问题': 'category',\n",
    "    '开屏广告浏览体验': 'category',\n",
    "    '开屏广告建议次数': 'category',\n",
    "    '开屏广告建议时长': 'category',\n",
    "    '开屏广告隐私侵犯感': 'category',\n",
    "    '开屏广告关闭键评价': 'category',\n",
    "    '开屏广告关闭键改进建议': 'category',\n",
    "})\n",
    "df4.dtypes.to_frame()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count     403.000000\n",
       "mean      130.684864\n",
       "std       135.326204\n",
       "min        18.000000\n",
       "25%        82.000000\n",
       "50%       107.000000\n",
       "75%       146.500000\n",
       "max      1995.000000\n",
       "Name: 填写问卷时长, dtype: float64"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df4['填写问卷时长'].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0      1\n",
       "1      0\n",
       "2      1\n",
       "3      1\n",
       "4      0\n",
       "      ..\n",
       "432    0\n",
       "433    0\n",
       "434    0\n",
       "435    0\n",
       "436    0\n",
       "Length: 403, dtype: int8"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df4['性别'].cat.codes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "女    272\n",
      "男    131\n",
      "Name: 性别, dtype: int64\n",
      "经常使用（4-8小时）    194\n",
      "重度使用（8小时以上）    175\n",
      "偶尔使用（2-4小时）     27\n",
      "很少使用（2小时以下）      7\n",
      "Name: 每天手机使用频率, dtype: int64\n",
      "7次及以上    156\n",
      "3-5      105\n",
      "1-3       68\n",
      "5-7       61\n",
      "0次        13\n",
      "Name: 日均接触开屏广告次数, dtype: int64\n",
      "其他       137\n",
      "休闲娱乐类     92\n",
      "美妆护肤类     68\n",
      "数码产品类     38\n",
      "服装鞋包类     38\n",
      "生活用品类     30\n",
      "Name: 开屏广告类型偏好, dtype: int64\n",
      "直接点击跳过       366\n",
      "等待广告自动结束      29\n",
      "观看广告并点击查看      8\n",
      "Name: 开屏广告操作习惯, dtype: int64\n",
      "很讨厌    278\n",
      "不介意    115\n",
      "很喜欢     10\n",
      "Name: 开屏广告态度, dtype: int64\n",
      "没有广告    252\n",
      "1-3秒    102\n",
      "3-5秒     44\n",
      "5秒以上      5\n",
      "Name: 开屏广告接收时长, dtype: int64\n",
      "一般理解     203\n",
      "完全不理解    139\n",
      "比较理解      55\n",
      "深刻理解       6\n",
      "Name: 开屏广告受众自评感知效果1, dtype: int64\n",
      "一般印象     162\n",
      "比较没印象     94\n",
      "完全没印象     86\n",
      "比较深       38\n",
      "非常深       23\n",
      "Name: 开屏广告受众自评感知效果2, dtype: int64\n",
      "单纯根据个人喜爱                                                   111\n",
      "喜欢的明星代言                                                     28\n",
      "画面色彩比较丰富                                                    18\n",
      "广告内容较感兴趣                                                    17\n",
      "画面色彩比较丰富┋单纯根据个人喜爱                                           16\n",
      "                                                          ... \n",
      "单纯根据个人喜爱┋静态图片┋视频广告                                           1\n",
      "单纯根据个人喜爱┋静态图片┋动态图片                                           1\n",
      "画面色彩比较丰富┋单纯根据个人喜爱┋广告内容较感兴趣┋喜欢的明星代言┋动态图片                      1\n",
      "画面色彩比较丰富┋单纯根据个人喜爱┋广告内容较感兴趣┋喜欢的明星代言┋有较大活动力度的广告┋动态图片┋视频广告      1\n",
      "静态图片┋动态图片┋视频广告                                               1\n",
      "Name: 有效开屏广告特征, Length: 89, dtype: int64\n",
      "否    264\n",
      "是    139\n",
      "Name: 开屏广告受众自评行动效果, dtype: int64\n",
      "有的不能点击跳过广告┋容易误触跳转到其他APP┋过度推广，容易误导消费者       102\n",
      "容易误触跳转到其他APP                                67\n",
      "有的不能点击跳过广告┋容易误触跳转到其他APP                     61\n",
      "容易误触跳转到其他APP┋过度推广，容易误导消费者                   50\n",
      "有的不能点击跳过广告┋容易误触跳转到其他APP┋过度推广，容易误导消费者┋其他     46\n",
      "有的不能点击跳过广告                                  25\n",
      "其他                                          18\n",
      "过度推广，容易误导消费者                                14\n",
      "容易误触跳转到其他APP┋其他                              7\n",
      "有的不能点击跳过广告┋过度推广，容易误导消费者                      5\n",
      "容易误触跳转到其他APP┋过度推广，容易误导消费者┋其他                 3\n",
      "有的不能点击跳过广告┋容易误触跳转到其他APP┋其他                   3\n",
      "有的不能点击跳过广告┋其他                                2\n",
      "Name: 开屏广告存在问题, dtype: int64\n",
      "有点影响     170\n",
      "非常影响     124\n",
      "比较影响      87\n",
      "完全不影响     22\n",
      "Name: 开屏广告浏览体验, dtype: int64\n",
      "0次（烦人的广告，没有最好了)            201\n",
      "1次给人留点赚广告费)                128\n",
      "2次给人多留点赚广告费)                63\n",
      "3次及以上（反正不影响我，出现多少次都没关系）     11\n",
      "Name: 开屏广告建议次数, dtype: int64\n",
      "3秒及以下（一闪而过）      276\n",
      "4秒勉强看清)           72\n",
      "5秒（看清楚了）          43\n",
      "6秒及以上（仔细看清楚了）     12\n",
      "Name: 开屏广告建议时长, dtype: int64\n",
      "是    282\n",
      "否    121\n",
      "Name: 开屏广告隐私侵犯感, dtype: int64\n",
      "是    211\n",
      "否    192\n",
      "Name: 开屏广告关闭键评价, dtype: int64\n",
      "关闭键位于明显处        250\n",
      "关机键在广告开启时便出现     87\n",
      "关闭键有动态提示         36\n",
      "关闭键不明显           30\n",
      "Name: 开屏广告关闭键改进建议, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "### 查找异常值\n",
    "#### 类别变量\n",
    "mytools.print_all_cats(df4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "count     403.000000\n",
      "mean      130.684864\n",
      "std       135.326204\n",
      "min        18.000000\n",
      "25%        82.000000\n",
      "50%       107.000000\n",
      "75%       146.500000\n",
      "max      1995.000000\n",
      "Name: 填写问卷时长, dtype: float64\n"
     ]
    }
   ],
   "source": [
    "#### 查看int类型的异常值\n",
    "mytools.print_all_int(df4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "bingroup": "x",
         "hovertemplate": "填写问卷时长=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "type": "histogram",
         "x": [
          71,
          108,
          81,
          86,
          83,
          240,
          134,
          97,
          108,
          130,
          60,
          93,
          63,
          21,
          56,
          138,
          94,
          120,
          589,
          107,
          171,
          195,
          146,
          99,
          83,
          49,
          53,
          127,
          88,
          68,
          109,
          85,
          74,
          163,
          131,
          95,
          94,
          127,
          112,
          103,
          59,
          158,
          109,
          60,
          56,
          81,
          82,
          73,
          82,
          82,
          104,
          105,
          170,
          59,
          59,
          112,
          37,
          155,
          116,
          91,
          181,
          56,
          81,
          91,
          73,
          75,
          127,
          80,
          76,
          68,
          95,
          196,
          93,
          92,
          155,
          121,
          144,
          84,
          110,
          136,
          60,
          23,
          82,
          99,
          98,
          71,
          115,
          57,
          162,
          112,
          70,
          65,
          84,
          95,
          70,
          107,
          166,
          55,
          80,
          101,
          122,
          48,
          148,
          33,
          86,
          74,
          115,
          131,
          92,
          49,
          96,
          226,
          83,
          218,
          187,
          204,
          204,
          162,
          53,
          265,
          112,
          88,
          270,
          70,
          83,
          92,
          67,
          97,
          130,
          78,
          106,
          81,
          145,
          129,
          174,
          584,
          122,
          52,
          86,
          145,
          111,
          144,
          116,
          55,
          89,
          300,
          157,
          165,
          24,
          67,
          91,
          138,
          80,
          100,
          98,
          82,
          153,
          57,
          87,
          85,
          117,
          29,
          73,
          240,
          83,
          54,
          118,
          128,
          78,
          93,
          135,
          117,
          113,
          48,
          144,
          48,
          106,
          166,
          128,
          145,
          103,
          77,
          85,
          110,
          121,
          95,
          120,
          104,
          148,
          152,
          73,
          102,
          171,
          160,
          146,
          62,
          30,
          184,
          177,
          93,
          78,
          72,
          120,
          109,
          112,
          302,
          131,
          63,
          67,
          394,
          102,
          28,
          85,
          124,
          136,
          68,
          75,
          147,
          133,
          123,
          89,
          83,
          124,
          138,
          101,
          122,
          193,
          105,
          376,
          45,
          182,
          111,
          210,
          68,
          76,
          85,
          268,
          91,
          228,
          196,
          129,
          118,
          136,
          102,
          172,
          104,
          96,
          82,
          96,
          188,
          86,
          76,
          86,
          152,
          112,
          80,
          257,
          108,
          77,
          94,
          105,
          151,
          162,
          186,
          53,
          79,
          198,
          101,
          123,
          102,
          127,
          87,
          64,
          113,
          86,
          141,
          177,
          97,
          58,
          187,
          235,
          165,
          186,
          202,
          67,
          255,
          91,
          335,
          324,
          123,
          80,
          100,
          147,
          70,
          124,
          139,
          184,
          74,
          123,
          184,
          64,
          69,
          110,
          157,
          117,
          55,
          91,
          82,
          102,
          84,
          90,
          204,
          101,
          124,
          111,
          160,
          108,
          233,
          79,
          94,
          181,
          53,
          146,
          74,
          163,
          172,
          128,
          171,
          120,
          131,
          72,
          95,
          133,
          1995,
          126,
          45,
          83,
          112,
          163,
          125,
          132,
          204,
          59,
          116,
          102,
          163,
          120,
          628,
          87,
          84,
          454,
          105,
          204,
          70,
          110,
          40,
          181,
          150,
          148,
          207,
          211,
          65,
          89,
          75,
          162,
          91,
          136,
          304,
          61,
          147,
          153,
          143,
          158,
          209,
          236,
          114,
          214,
          378,
          88,
          89,
          52,
          113,
          18,
          98,
          83,
          164,
          95,
          110,
          80,
          1451,
          50,
          94,
          54,
          270,
          145,
          129,
          64,
          178,
          169,
          146,
          97,
          175,
          116
         ],
         "xaxis": "x",
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "填写问卷时长"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "count"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#### 通过直方图观察数值变量的异常值\n",
    "fig = px.histogram(df4, x=\"填写问卷时长\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "填写问卷时长=%{x}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa"
         },
         "name": "",
         "notched": false,
         "offsetgroup": "",
         "orientation": "h",
         "showlegend": false,
         "type": "box",
         "x": [
          71,
          108,
          81,
          86,
          83,
          240,
          134,
          97,
          108,
          130,
          60,
          93,
          63,
          21,
          56,
          138,
          94,
          120,
          589,
          107,
          171,
          195,
          146,
          99,
          83,
          49,
          53,
          127,
          88,
          68,
          109,
          85,
          74,
          163,
          131,
          95,
          94,
          127,
          112,
          103,
          59,
          158,
          109,
          60,
          56,
          81,
          82,
          73,
          82,
          82,
          104,
          105,
          170,
          59,
          59,
          112,
          37,
          155,
          116,
          91,
          181,
          56,
          81,
          91,
          73,
          75,
          127,
          80,
          76,
          68,
          95,
          196,
          93,
          92,
          155,
          121,
          144,
          84,
          110,
          136,
          60,
          23,
          82,
          99,
          98,
          71,
          115,
          57,
          162,
          112,
          70,
          65,
          84,
          95,
          70,
          107,
          166,
          55,
          80,
          101,
          122,
          48,
          148,
          33,
          86,
          74,
          115,
          131,
          92,
          49,
          96,
          226,
          83,
          218,
          187,
          204,
          204,
          162,
          53,
          265,
          112,
          88,
          270,
          70,
          83,
          92,
          67,
          97,
          130,
          78,
          106,
          81,
          145,
          129,
          174,
          584,
          122,
          52,
          86,
          145,
          111,
          144,
          116,
          55,
          89,
          300,
          157,
          165,
          24,
          67,
          91,
          138,
          80,
          100,
          98,
          82,
          153,
          57,
          87,
          85,
          117,
          29,
          73,
          240,
          83,
          54,
          118,
          128,
          78,
          93,
          135,
          117,
          113,
          48,
          144,
          48,
          106,
          166,
          128,
          145,
          103,
          77,
          85,
          110,
          121,
          95,
          120,
          104,
          148,
          152,
          73,
          102,
          171,
          160,
          146,
          62,
          30,
          184,
          177,
          93,
          78,
          72,
          120,
          109,
          112,
          302,
          131,
          63,
          67,
          394,
          102,
          28,
          85,
          124,
          136,
          68,
          75,
          147,
          133,
          123,
          89,
          83,
          124,
          138,
          101,
          122,
          193,
          105,
          376,
          45,
          182,
          111,
          210,
          68,
          76,
          85,
          268,
          91,
          228,
          196,
          129,
          118,
          136,
          102,
          172,
          104,
          96,
          82,
          96,
          188,
          86,
          76,
          86,
          152,
          112,
          80,
          257,
          108,
          77,
          94,
          105,
          151,
          162,
          186,
          53,
          79,
          198,
          101,
          123,
          102,
          127,
          87,
          64,
          113,
          86,
          141,
          177,
          97,
          58,
          187,
          235,
          165,
          186,
          202,
          67,
          255,
          91,
          335,
          324,
          123,
          80,
          100,
          147,
          70,
          124,
          139,
          184,
          74,
          123,
          184,
          64,
          69,
          110,
          157,
          117,
          55,
          91,
          82,
          102,
          84,
          90,
          204,
          101,
          124,
          111,
          160,
          108,
          233,
          79,
          94,
          181,
          53,
          146,
          74,
          163,
          172,
          128,
          171,
          120,
          131,
          72,
          95,
          133,
          1995,
          126,
          45,
          83,
          112,
          163,
          125,
          132,
          204,
          59,
          116,
          102,
          163,
          120,
          628,
          87,
          84,
          454,
          105,
          204,
          70,
          110,
          40,
          181,
          150,
          148,
          207,
          211,
          65,
          89,
          75,
          162,
          91,
          136,
          304,
          61,
          147,
          153,
          143,
          158,
          209,
          236,
          114,
          214,
          378,
          88,
          89,
          52,
          113,
          18,
          98,
          83,
          164,
          95,
          110,
          80,
          1451,
          50,
          94,
          54,
          270,
          145,
          129,
          64,
          178,
          169,
          146,
          97,
          175,
          116
         ],
         "x0": " ",
         "xaxis": "x",
         "y0": " ",
         "yaxis": "y"
        }
       ],
       "layout": {
        "boxmode": "group",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "填写问卷时长"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ]
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#### 通过箱线图观察数值变量的异常值\n",
    "fig = px.box(df4, x=\"填写问卷时长\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 删除异常值\n",
    "df5 = df4.drop(df4.query('(填写问卷时长 >628) or (填写问卷时长 <= 50)').index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "bingroup": "x",
         "hovertemplate": "填写问卷时长=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "type": "histogram",
         "x": [
          71,
          108,
          81,
          86,
          83,
          240,
          134,
          97,
          108,
          130,
          60,
          93,
          63,
          56,
          138,
          94,
          120,
          589,
          107,
          171,
          195,
          146,
          99,
          83,
          53,
          127,
          88,
          68,
          109,
          85,
          74,
          163,
          131,
          95,
          94,
          127,
          112,
          103,
          59,
          158,
          109,
          60,
          56,
          81,
          82,
          73,
          82,
          82,
          104,
          105,
          170,
          59,
          59,
          112,
          155,
          116,
          91,
          181,
          56,
          81,
          91,
          73,
          75,
          127,
          80,
          76,
          68,
          95,
          196,
          93,
          92,
          155,
          121,
          144,
          84,
          110,
          136,
          60,
          82,
          99,
          98,
          71,
          115,
          57,
          162,
          112,
          70,
          65,
          84,
          95,
          70,
          107,
          166,
          55,
          80,
          101,
          122,
          148,
          86,
          74,
          115,
          131,
          92,
          96,
          226,
          83,
          218,
          187,
          204,
          204,
          162,
          53,
          265,
          112,
          88,
          270,
          70,
          83,
          92,
          67,
          97,
          130,
          78,
          106,
          81,
          145,
          129,
          174,
          584,
          122,
          52,
          86,
          145,
          111,
          144,
          116,
          55,
          89,
          300,
          157,
          165,
          67,
          91,
          138,
          80,
          100,
          98,
          82,
          153,
          57,
          87,
          85,
          117,
          73,
          240,
          83,
          54,
          118,
          128,
          78,
          93,
          135,
          117,
          113,
          144,
          106,
          166,
          128,
          145,
          103,
          77,
          85,
          110,
          121,
          95,
          120,
          104,
          148,
          152,
          73,
          102,
          171,
          160,
          146,
          62,
          184,
          177,
          93,
          78,
          72,
          120,
          109,
          112,
          302,
          131,
          63,
          67,
          394,
          102,
          85,
          124,
          136,
          68,
          75,
          147,
          133,
          123,
          89,
          83,
          124,
          138,
          101,
          122,
          193,
          105,
          376,
          182,
          111,
          210,
          68,
          76,
          85,
          268,
          91,
          228,
          196,
          129,
          118,
          136,
          102,
          172,
          104,
          96,
          82,
          96,
          188,
          86,
          76,
          86,
          152,
          112,
          80,
          257,
          108,
          77,
          94,
          105,
          151,
          162,
          186,
          53,
          79,
          198,
          101,
          123,
          102,
          127,
          87,
          64,
          113,
          86,
          141,
          177,
          97,
          58,
          187,
          235,
          165,
          186,
          202,
          67,
          255,
          91,
          335,
          324,
          123,
          80,
          100,
          147,
          70,
          124,
          139,
          184,
          74,
          123,
          184,
          64,
          69,
          110,
          157,
          117,
          55,
          91,
          82,
          102,
          84,
          90,
          204,
          101,
          124,
          111,
          160,
          108,
          233,
          79,
          94,
          181,
          53,
          146,
          74,
          163,
          172,
          128,
          171,
          120,
          131,
          72,
          95,
          133,
          126,
          83,
          112,
          163,
          125,
          132,
          204,
          59,
          116,
          102,
          163,
          120,
          628,
          87,
          84,
          454,
          105,
          204,
          70,
          110,
          181,
          150,
          148,
          207,
          211,
          65,
          89,
          75,
          162,
          91,
          136,
          304,
          61,
          147,
          153,
          143,
          158,
          209,
          236,
          114,
          214,
          378,
          88,
          89,
          52,
          113,
          98,
          83,
          164,
          95,
          110,
          80,
          94,
          54,
          270,
          145,
          129,
          64,
          178,
          169,
          146,
          97,
          175,
          116
         ],
         "xaxis": "x",
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "填写问卷时长"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "count"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#### 通过图形观察数值变量\n",
    "fig = px.histogram(df5, x=\"填写问卷时长\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 数据清理完毕，进入数据分析环节\n",
    "\n",
    "df = df5.copy()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据分析\n",
    "\n",
    "### 描述统计\n",
    "\n",
    "先描述样本背景，对样本质量进行评价。再描述样本特征信息、样本基本现状，最后描述样本基本态度及其他维度。\n",
    "\n",
    "描述统计分析也应该有理论依据或概念合理的分类。\n",
    "\n",
    "### 推论统计\n",
    "\n",
    "可进行一些相关性、差异性分析以及回归分析。合理分析变量之间的相关性。\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 样本质量评估\n",
    "\n",
    "1. 检查抽样实施过程，汇报抽样过程。（是否随机是关键）\n",
    "2. 通过样本与总体共有的特征，评估样本质量。（误差小是关键）\n",
    "\n",
    "\n",
    "#### 样本背景\n",
    "\n",
    "本次描述性研究的样本背景变量只有一个，即性别，将样本的性别比例与总体的性别比例进行对比，可进行样本质量的评估。\n",
    "\n",
    "需要汇报数据获取方式（时间、渠道、样本量、有效样本量），"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>性别</th>\n",
       "      <th>个数</th>\n",
       "      <th>百分比</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>女</td>\n",
       "      <td>263</td>\n",
       "      <td>68.67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>男</td>\n",
       "      <td>120</td>\n",
       "      <td>31.33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>总和</td>\n",
       "      <td>383</td>\n",
       "      <td>100.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   性别   个数     百分比\n",
       "0   女  263   68.67\n",
       "1   男  120   31.33\n",
       "2  总和  383  100.00"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 样本特征（性别）与总体特征的对比\n",
    "mytools.gen_percent_table(df,'性别')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "样本中男女比例为69：31，与总体中的51:49有差距，因XXXX的原因，导致样本中的性别出现了上述偏差，但XXXX，故可认为样本的质量XXX。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 样本特征分析\n",
    "\n",
    "所谓样本特征，就是与研究目的相关的一些变量，如媒介接触行为、广告接触行为等等。\n",
    "\n",
    "本次研究中，相关的题目为：“第2题：您每天使用手机的频率[单选题]”"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "CategoricalDtype(categories=['偶尔使用（2-4小时）', '很少使用（2小时以下）', '经常使用（4-8小时）', '重度使用（8小时以上）'], ordered=False)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 确保变量类型合适\n",
    "df['每天手机使用频率'].dtype"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "cat_type = CategoricalDtype(categories=['很少使用（2小时以下）', '偶尔使用（2-4小时）', '经常使用（4-8小时）', '重度使用（8小时以上）'],\n",
    "                            ordered=True)\n",
    "df['每天手机使用频率'] = df['每天手机使用频率'].astype(cat_type)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "CategoricalDtype(categories=['很少使用（2小时以下）', '偶尔使用（2-4小时）', '经常使用（4-8小时）', '重度使用（8小时以上）'], ordered=True)"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['每天手机使用频率'].dtype"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>每天手机使用频率</th>\n",
       "      <th>个数</th>\n",
       "      <th>百分比</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>很少使用（2小时以下）</td>\n",
       "      <td>4</td>\n",
       "      <td>1.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>偶尔使用（2-4小时）</td>\n",
       "      <td>24</td>\n",
       "      <td>6.27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>经常使用（4-8小时）</td>\n",
       "      <td>187</td>\n",
       "      <td>48.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>重度使用（8小时以上）</td>\n",
       "      <td>168</td>\n",
       "      <td>43.86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>总和</td>\n",
       "      <td>383</td>\n",
       "      <td>100.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      每天手机使用频率   个数     百分比\n",
       "0  很少使用（2小时以下）    4    1.04\n",
       "1  偶尔使用（2-4小时）   24    6.27\n",
       "2  经常使用（4-8小时）  187   48.83\n",
       "3  重度使用（8小时以上）  168   43.86\n",
       "4           总和  383  100.00"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mytools.gen_percent_table(df,'每天手机使用频率',sort=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "每天手机使用频率=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "很少使用（2小时以下）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "很少使用（2小时以下）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "很少使用（2小时以下）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "很少使用（2小时以下）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "偶尔使用（2-4小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "重度使用（8小时以上）",
          "经常使用（4-8小时）"
         ],
         "xaxis": "x",
         "y": [
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "每天手机使用频率"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "count"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(df,x=\"每天手机使用频率\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "result = df['每天手机使用频率'].value_counts(sort=False,\n",
    "                                     normalize=True).to_frame() * 100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "index=%{x}<br>每天手机使用频率=%{text}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "text": [
          1.0443864229765014,
          6.266318537859007,
          48.825065274151434,
          43.86422976501306
         ],
         "textposition": "outside",
         "texttemplate": "%{text:.1f}%",
         "type": "bar",
         "x": [
          "很少使用（2小时以下）",
          "偶尔使用（2-4小时）",
          "经常使用（4-8小时）",
          "重度使用（8小时以上）"
         ],
         "xaxis": "x",
         "y": [
          1.0443864229765014,
          6.266318537859007,
          48.825065274151434,
          43.86422976501306
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "height": 500,
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "white",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "white",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "#C8D4E3",
             "linecolor": "#C8D4E3",
             "minorgridcolor": "#C8D4E3",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "#C8D4E3",
             "linecolor": "#C8D4E3",
             "minorgridcolor": "#C8D4E3",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "white",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "#C8D4E3"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "white",
          "polar": {
           "angularaxis": {
            "gridcolor": "#EBF0F8",
            "linecolor": "#EBF0F8",
            "ticks": ""
           },
           "bgcolor": "white",
           "radialaxis": {
            "gridcolor": "#EBF0F8",
            "linecolor": "#EBF0F8",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "white",
            "gridcolor": "#DFE8F3",
            "gridwidth": 2,
            "linecolor": "#EBF0F8",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "#EBF0F8"
           },
           "yaxis": {
            "backgroundcolor": "white",
            "gridcolor": "#DFE8F3",
            "gridwidth": 2,
            "linecolor": "#EBF0F8",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "#EBF0F8"
           },
           "zaxis": {
            "backgroundcolor": "white",
            "gridcolor": "#DFE8F3",
            "gridwidth": 2,
            "linecolor": "#EBF0F8",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "#EBF0F8"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "#DFE8F3",
            "linecolor": "#A2B1C6",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "#DFE8F3",
            "linecolor": "#A2B1C6",
            "ticks": ""
           },
           "bgcolor": "white",
           "caxis": {
            "gridcolor": "#DFE8F3",
            "linecolor": "#A2B1C6",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "#EBF0F8",
           "linecolor": "#EBF0F8",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "#EBF0F8",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "#EBF0F8",
           "linecolor": "#EBF0F8",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "#EBF0F8",
           "zerolinewidth": 2
          }
         }
        },
        "width": 700,
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "每天手机使用频率"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "比例(%)"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(\n",
    "    result,\n",
    "    x=result.index,\n",
    "    y='每天手机使用频率',\n",
    "    text='每天手机使用频率',\n",
    "    text_auto=True,\n",
    "    # range_y=[0, 60],\n",
    "    width=700,\n",
    "    height=500,\n",
    "    template='plotly_white'\n",
    ")\n",
    "fig.update_traces(\n",
    "    texttemplate='%{text:.1f}%',\n",
    "    textposition='outside',\n",
    ")\n",
    "fig.update_layout(\n",
    "    xaxis_title=\"每天手机使用频率\",\n",
    "    yaxis_title=\"比例(%)\",\n",
    ")\n",
    "fig.write_image(\"fig1.svg\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 多选题分析\n",
    "\n",
    "如果内容为“单纯根据个人喜爱┋广告内容较感兴趣┋喜欢的明星代言┋视频广告”，则统计所有类别，生成所有多选题选项的表格。\n",
    "如：\n",
    "|选项|次数|比例（%）|\n",
    "|--|--|--|\n",
    "|单纯根据个人喜爱|20|5.5|\n",
    "|广告内容较感兴趣|20|5.5|\n",
    "|喜欢的明星代言|20|5.5|\n",
    "|视频广告|20|5.5|"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "其他\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "其他\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "其他\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "游戏类（消消乐、纪念碑谷等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "资讯类（今日头条、知乎日报等）\n",
      "购物类（淘宝、京东等）\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "便捷牛活类（美团、天气、地图等）\n",
      "拍摄美化类（美图秀秀、美拍等）\n",
      "购物类（淘宝、京东等）\n",
      "其他\n",
      "社交通讯类（微信、微博、QQ等）\n",
      "影音娱乐类（腾讯视频、搜影狐视频等）\n",
      "购物类（淘宝、京东等）\n"
     ]
    }
   ],
   "source": [
    "#### 构造一个表格，包含多选题的所有选项及出现的次数和比例\n",
    "df5['test'] = df5['最常接触开屏广告的APP类型'].str.split('┋')\n",
    "mcq_items = []\n",
    "for g in df5['test']:\n",
    "    # print(g)\n",
    "    for label in g:\n",
    "        print(label)\n",
    "        mcq_items.append(label)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "result = list(set(mcq_items))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_mcq_1 = pd.DataFrame(data=np.zeros([len(result),2]),index=result,columns=['次数','比例'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in df5['最常接触开屏广告的APP类型']:\n",
    "    for label in result:\n",
    "        if str(i).__contains__(label):\n",
    "            df_mcq_1.loc[label,'次数'] += 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "\"\"\"生成比例列\"\"\"\n",
    "df_mcq_1['比例'] = df_mcq_1['次数']/df5.shape[0]*100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_mcq_1 = df_mcq_1.sort_values(by='比例')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>次数</th>\n",
       "      <th>比例</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>拍摄美化类（美图秀秀、美拍等）</th>\n",
       "      <td>63.0</td>\n",
       "      <td>16.449086</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏类（消消乐、纪念碑谷等）</th>\n",
       "      <td>80.0</td>\n",
       "      <td>20.887728</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>其他</th>\n",
       "      <td>83.0</td>\n",
       "      <td>21.671018</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>便捷牛活类（美团、天气、地图等）</th>\n",
       "      <td>96.0</td>\n",
       "      <td>25.065274</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>资讯类（今日头条、知乎日报等）</th>\n",
       "      <td>97.0</td>\n",
       "      <td>25.326371</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>影音娱乐类（腾讯视频、搜影狐视频等）</th>\n",
       "      <td>171.0</td>\n",
       "      <td>44.647520</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>购物类（淘宝、京东等）</th>\n",
       "      <td>205.0</td>\n",
       "      <td>53.524804</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>社交通讯类（微信、微博、QQ等）</th>\n",
       "      <td>219.0</td>\n",
       "      <td>57.180157</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                       次数         比例\n",
       "拍摄美化类（美图秀秀、美拍等）      63.0  16.449086\n",
       "游戏类（消消乐、纪念碑谷等）       80.0  20.887728\n",
       "其他                   83.0  21.671018\n",
       "便捷牛活类（美团、天气、地图等）     96.0  25.065274\n",
       "资讯类（今日头条、知乎日报等）      97.0  25.326371\n",
       "影音娱乐类（腾讯视频、搜影狐视频等）  171.0  44.647520\n",
       "购物类（淘宝、京东等）         205.0  53.524804\n",
       "社交通讯类（微信、微博、QQ等）    219.0  57.180157"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_mcq_1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "比例=%{x}<br>index=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "h",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          16.449086161879894,
          20.887728459530024,
          21.671018276762403,
          25.06527415143603,
          25.326370757180154,
          44.64751958224543,
          53.52480417754569,
          57.180156657963444
         ],
         "xaxis": "x",
         "y": [
          "拍摄美化类（美图秀秀、美拍等）",
          "游戏类（消消乐、纪念碑谷等）",
          "其他",
          "便捷牛活类（美团、天气、地图等）",
          "资讯类（今日头条、知乎日报等）",
          "影音娱乐类（腾讯视频、搜影狐视频等）",
          "购物类（淘宝、京东等）",
          "社交通讯类（微信、微博、QQ等）"
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "比例"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "index"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(df_mcq_1, x=\"比例\",orientation='h')\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 定义一个针对问卷星数据多选题的分析函数\n",
    "\n",
    "\n",
    "def gen_mcq_df(df,x,pattern='┋'):\n",
    "    \"\"\"\n",
    "    定义一个针对问卷星数据多选题的分析函数\n",
    "    \n",
    "    df: 数据框\n",
    "    x: 问卷星中定义的多选题\n",
    "\n",
    "    返回值： 一个包含所有选项及出现次数和所占比例的数据框\n",
    "\n",
    "    如：\n",
    "\n",
    "    |选项|次数|比例（%）|\n",
    "    |--|--|--|\n",
    "    |单纯根据个人喜爱|20|5.5|\n",
    "    |广告内容较感兴趣|20|5.5|\n",
    "    |喜欢的明星代言|20|5.5|\n",
    "    |视频广告|20|5.5|\n",
    "       \n",
    "    \"\"\"\n",
    "    # 按照指定分隔符将多选题字符串转化包含多个选项的列表\n",
    "    df['temp'] = df[x].str.split(pattern)\n",
    "    # 初始化列表，用于保存所有多选题选项\n",
    "    mcq_items = []\n",
    "    # 循环所有个案，获取所有多选题选项\n",
    "    for g in df['temp']:\n",
    "        for label in g:\n",
    "            # print(label)\n",
    "            mcq_items.append(label)\n",
    "    # 将多选题选项去重后转化为列表，方便构造dataframe\n",
    "    result = list(set(mcq_items))\n",
    "    # 构造包含选项、次数和比例的空表\n",
    "    df_mcq_1 = pd.DataFrame(data=np.zeros([len(result), 2]),\n",
    "                            index=result,\n",
    "                            columns=['次数', '比例'])\n",
    "    # 通过循环获取每个选项在多选题中累次出现的次数\n",
    "    for i in df[x]:\n",
    "        for label in result:\n",
    "            if str(i).__contains__(label):\n",
    "                df_mcq_1.loc[label, '次数'] += 1\n",
    "    # 生成比例列\n",
    "    df_mcq_1['比例'] = df_mcq_1['次数'] / df.shape[0] * 100\n",
    "\n",
    "    return df_mcq_1.astype({'次数':\"int\"})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>次数</th>\n",
       "      <th>比例</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>拍摄美化类（美图秀秀、美拍等）</th>\n",
       "      <td>63</td>\n",
       "      <td>16.449086</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏类（消消乐、纪念碑谷等）</th>\n",
       "      <td>80</td>\n",
       "      <td>20.887728</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>其他</th>\n",
       "      <td>83</td>\n",
       "      <td>21.671018</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>便捷牛活类（美团、天气、地图等）</th>\n",
       "      <td>96</td>\n",
       "      <td>25.065274</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>资讯类（今日头条、知乎日报等）</th>\n",
       "      <td>97</td>\n",
       "      <td>25.326371</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>影音娱乐类（腾讯视频、搜影狐视频等）</th>\n",
       "      <td>171</td>\n",
       "      <td>44.647520</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>购物类（淘宝、京东等）</th>\n",
       "      <td>205</td>\n",
       "      <td>53.524804</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>社交通讯类（微信、微博、QQ等）</th>\n",
       "      <td>219</td>\n",
       "      <td>57.180157</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     次数         比例\n",
       "拍摄美化类（美图秀秀、美拍等）      63  16.449086\n",
       "游戏类（消消乐、纪念碑谷等）       80  20.887728\n",
       "其他                   83  21.671018\n",
       "便捷牛活类（美团、天气、地图等）     96  25.065274\n",
       "资讯类（今日头条、知乎日报等）      97  25.326371\n",
       "影音娱乐类（腾讯视频、搜影狐视频等）  171  44.647520\n",
       "购物类（淘宝、京东等）         205  53.524804\n",
       "社交通讯类（微信、微博、QQ等）    219  57.180157"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ad_app_type = gen_mcq_df(df,'最常接触开屏广告的APP类型')\n",
    "ad_app_type = ad_app_type.sort_values(by='比例')\n",
    "ad_app_type"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "比例=%{x}<br>index=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "h",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          16.449086161879894,
          20.887728459530024,
          21.671018276762403,
          25.06527415143603,
          25.326370757180154,
          44.64751958224543,
          53.52480417754569,
          57.180156657963444
         ],
         "xaxis": "x",
         "y": [
          "拍摄美化类（美图秀秀、美拍等）",
          "游戏类（消消乐、纪念碑谷等）",
          "其他",
          "便捷牛活类（美团、天气、地图等）",
          "资讯类（今日头条、知乎日报等）",
          "影音娱乐类（腾讯视频、搜影狐视频等）",
          "购物类（淘宝、京东等）",
          "社交通讯类（微信、微博、QQ等）"
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "比例"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "index"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(ad_app_type, x=\"比例\",orientation='h')\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>次数</th>\n",
       "      <th>比例</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>拍摄美化类（美图秀秀、美拍等）</th>\n",
       "      <td>63</td>\n",
       "      <td>16.449086</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏类（消消乐、纪念碑谷等）</th>\n",
       "      <td>80</td>\n",
       "      <td>20.887728</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>其他</th>\n",
       "      <td>83</td>\n",
       "      <td>21.671018</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>便捷牛活类（美团、天气、地图等）</th>\n",
       "      <td>96</td>\n",
       "      <td>25.065274</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>资讯类（今日头条、知乎日报等）</th>\n",
       "      <td>97</td>\n",
       "      <td>25.326371</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>影音娱乐类（腾讯视频、搜影狐视频等）</th>\n",
       "      <td>171</td>\n",
       "      <td>44.647520</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>购物类（淘宝、京东等）</th>\n",
       "      <td>205</td>\n",
       "      <td>53.524804</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>社交通讯类（微信、微博、QQ等）</th>\n",
       "      <td>219</td>\n",
       "      <td>57.180157</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     次数         比例\n",
       "拍摄美化类（美图秀秀、美拍等）      63  16.449086\n",
       "游戏类（消消乐、纪念碑谷等）       80  20.887728\n",
       "其他                   83  21.671018\n",
       "便捷牛活类（美团、天气、地图等）     96  25.065274\n",
       "资讯类（今日头条、知乎日报等）      97  25.326371\n",
       "影音娱乐类（腾讯视频、搜影狐视频等）  171  44.647520\n",
       "购物类（淘宝、京东等）         205  53.524804\n",
       "社交通讯类（微信、微博、QQ等）    219  57.180157"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ad_app_type = mytools.gen_mcq_df(df,'最常接触开屏广告的APP类型')\n",
    "ad_app_type = ad_app_type.sort_values(by='比例')\n",
    "ad_app_type"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>次数</th>\n",
       "      <th>比例</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>静态图片</th>\n",
       "      <td>29</td>\n",
       "      <td>7.571802</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>动态图片</th>\n",
       "      <td>43</td>\n",
       "      <td>11.227154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>视频广告</th>\n",
       "      <td>46</td>\n",
       "      <td>12.010444</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>有较大活动力度的广告</th>\n",
       "      <td>59</td>\n",
       "      <td>15.404700</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>画面色彩比较丰富</th>\n",
       "      <td>113</td>\n",
       "      <td>29.503916</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>喜欢的明星代言</th>\n",
       "      <td>113</td>\n",
       "      <td>29.503916</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>广告内容较感兴趣</th>\n",
       "      <td>121</td>\n",
       "      <td>31.592689</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>单纯根据个人喜爱</th>\n",
       "      <td>250</td>\n",
       "      <td>65.274151</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             次数         比例\n",
       "静态图片         29   7.571802\n",
       "动态图片         43  11.227154\n",
       "视频广告         46  12.010444\n",
       "有较大活动力度的广告   59  15.404700\n",
       "画面色彩比较丰富    113  29.503916\n",
       "喜欢的明星代言     113  29.503916\n",
       "广告内容较感兴趣    121  31.592689\n",
       "单纯根据个人喜爱    250  65.274151"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ad_feature = mytools.gen_mcq_df(df,'有效开屏广告特征')\n",
    "ad_feature = ad_feature.sort_values(by='比例')\n",
    "ad_feature"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "比例=%{x}<br>index=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "h",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          7.5718015665796345,
          11.22715404699739,
          12.010443864229766,
          15.404699738903393,
          29.50391644908616,
          29.50391644908616,
          31.59268929503917,
          65.27415143603133
         ],
         "xaxis": "x",
         "y": [
          "静态图片",
          "动态图片",
          "视频广告",
          "有较大活动力度的广告",
          "画面色彩比较丰富",
          "喜欢的明星代言",
          "广告内容较感兴趣",
          "单纯根据个人喜爱"
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "比例"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "index"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(ad_feature, x=\"比例\",orientation='h')\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 推论统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>开屏广告态度</th>\n",
       "      <th>个数</th>\n",
       "      <th>百分比</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>很讨厌</td>\n",
       "      <td>275</td>\n",
       "      <td>71.80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>不介意</td>\n",
       "      <td>103</td>\n",
       "      <td>26.89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>很喜欢</td>\n",
       "      <td>5</td>\n",
       "      <td>1.31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>总和</td>\n",
       "      <td>383</td>\n",
       "      <td>100.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  开屏广告态度   个数     百分比\n",
       "0    很讨厌  275   71.80\n",
       "1    不介意  103   26.89\n",
       "2    很喜欢    5    1.31\n",
       "3     总和  383  100.00"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mytools.gen_percent_table(df,'开屏广告态度')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>性别</th>\n",
       "      <th>女</th>\n",
       "      <th>男</th>\n",
       "      <th>合计</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告态度</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>不介意</th>\n",
       "      <td>27.38</td>\n",
       "      <td>25.83</td>\n",
       "      <td>26.89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>很喜欢</th>\n",
       "      <td>0.76</td>\n",
       "      <td>2.50</td>\n",
       "      <td>1.31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>很讨厌</th>\n",
       "      <td>71.86</td>\n",
       "      <td>71.67</td>\n",
       "      <td>71.80</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "性别          女      男     合计\n",
       "开屏广告态度                     \n",
       "不介意     27.38  25.83  26.89\n",
       "很喜欢      0.76   2.50   1.31\n",
       "很讨厌     71.86  71.67  71.80"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 双变量统计分析\n",
    "result = pd.crosstab(\n",
    "        df['开屏广告态度'],\n",
    "        df['性别'],\n",
    "        normalize='columns',\n",
    "        margins=True,\n",
    "        margins_name='合计',\n",
    "    )*100\n",
    "result.round(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>开屏广告态度</th>\n",
       "      <th>性别</th>\n",
       "      <th>频次</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>不介意</td>\n",
       "      <td>女</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>不介意</td>\n",
       "      <td>男</td>\n",
       "      <td>31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>很喜欢</td>\n",
       "      <td>女</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>很喜欢</td>\n",
       "      <td>男</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>很讨厌</td>\n",
       "      <td>女</td>\n",
       "      <td>189</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>很讨厌</td>\n",
       "      <td>男</td>\n",
       "      <td>86</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  开屏广告态度 性别   频次\n",
       "0    不介意  女   72\n",
       "1    不介意  男   31\n",
       "2    很喜欢  女    2\n",
       "3    很喜欢  男    3\n",
       "4    很讨厌  女  189\n",
       "5    很讨厌  男   86"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 构建绘图用数据表\n",
    "sun_df = df.groupby([\"开屏广告态度\",'性别']).size().reset_index(name='频次')\n",
    "sun_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>频次</th>\n",
       "      <th>%</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>开屏广告态度</th>\n",
       "      <th>性别</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">不介意</th>\n",
       "      <th>女</th>\n",
       "      <td>72</td>\n",
       "      <td>27.38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>男</th>\n",
       "      <td>31</td>\n",
       "      <td>25.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">很喜欢</th>\n",
       "      <th>女</th>\n",
       "      <td>2</td>\n",
       "      <td>0.76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>男</th>\n",
       "      <td>3</td>\n",
       "      <td>2.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">很讨厌</th>\n",
       "      <th>女</th>\n",
       "      <td>189</td>\n",
       "      <td>71.86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>男</th>\n",
       "      <td>86</td>\n",
       "      <td>71.67</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            频次      %\n",
       "开屏广告态度 性别            \n",
       "不介意    女    72  27.38\n",
       "       男    31  25.83\n",
       "很喜欢    女     2   0.76\n",
       "       男     3   2.50\n",
       "很讨厌    女   189  71.86\n",
       "       男    86  71.67"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "temp = sun_df.set_index(['开屏广告态度','性别'])\n",
    "temp['%'] = 100 * (temp / temp.groupby('性别').sum())\n",
    "temp.round(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>开屏广告态度</th>\n",
       "      <th>性别</th>\n",
       "      <th>频次</th>\n",
       "      <th>%</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>不介意</td>\n",
       "      <td>女</td>\n",
       "      <td>72</td>\n",
       "      <td>27.376426</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>不介意</td>\n",
       "      <td>男</td>\n",
       "      <td>31</td>\n",
       "      <td>25.833333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>很喜欢</td>\n",
       "      <td>女</td>\n",
       "      <td>2</td>\n",
       "      <td>0.760456</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>很喜欢</td>\n",
       "      <td>男</td>\n",
       "      <td>3</td>\n",
       "      <td>2.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>很讨厌</td>\n",
       "      <td>女</td>\n",
       "      <td>189</td>\n",
       "      <td>71.863118</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>很讨厌</td>\n",
       "      <td>男</td>\n",
       "      <td>86</td>\n",
       "      <td>71.666667</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  开屏广告态度 性别   频次          %\n",
       "0    不介意  女   72  27.376426\n",
       "1    不介意  男   31  25.833333\n",
       "2    很喜欢  女    2   0.760456\n",
       "3    很喜欢  男    3   2.500000\n",
       "4    很讨厌  女  189  71.863118\n",
       "5    很讨厌  男   86  71.666667"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sun_df = temp.reset_index()\n",
    "sun_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "branchvalues": "total",
         "domain": {
          "x": [
           0,
           1
          ],
          "y": [
           0,
           1
          ]
         },
         "hovertemplate": "labels=%{label}<br>%=%{value}<br>parent=%{parent}<br>id=%{id}<extra></extra>",
         "ids": [
          "不介意/女",
          "很喜欢/女",
          "很讨厌/女",
          "不介意/男",
          "很喜欢/男",
          "很讨厌/男",
          "不介意",
          "很喜欢",
          "很讨厌"
         ],
         "labels": [
          "女",
          "女",
          "女",
          "男",
          "男",
          "男",
          "不介意",
          "很喜欢",
          "很讨厌"
         ],
         "name": "",
         "parents": [
          "不介意",
          "很喜欢",
          "很讨厌",
          "不介意",
          "很喜欢",
          "很讨厌",
          "",
          "",
          ""
         ],
         "type": "sunburst",
         "values": [
          27.376425855513308,
          0.7604562737642585,
          71.86311787072243,
          25.833333333333336,
          2.5,
          71.66666666666667,
          53.20975918884665,
          3.2604562737642584,
          143.5297845373891
         ]
        }
       ],
       "layout": {
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.sunburst(sun_df,\n",
    "                  path=['开屏广告态度','性别'],\n",
    "                  values='%',\n",
    "                 )\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>开屏广告态度=很讨厌<br>%=%{y}<extra></extra>",
         "legendgroup": "女",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "女",
         "offsetgroup": "女",
         "orientation": "v",
         "showlegend": true,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "女"
         ],
         "xaxis": "x",
         "y": [
          71.86311787072243
         ],
         "yaxis": "y"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>开屏广告态度=不介意<br>%=%{y}<extra></extra>",
         "legendgroup": "女",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "女",
         "offsetgroup": "女",
         "orientation": "v",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "女"
         ],
         "xaxis": "x2",
         "y": [
          27.376425855513308
         ],
         "yaxis": "y2"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>开屏广告态度=很喜欢<br>%=%{y}<extra></extra>",
         "legendgroup": "女",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "女",
         "offsetgroup": "女",
         "orientation": "v",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "女"
         ],
         "xaxis": "x3",
         "y": [
          0.7604562737642585
         ],
         "yaxis": "y3"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>开屏广告态度=很讨厌<br>%=%{y}<extra></extra>",
         "legendgroup": "男",
         "marker": {
          "color": "#EF553B",
          "pattern": {
           "shape": ""
          }
         },
         "name": "男",
         "offsetgroup": "男",
         "orientation": "v",
         "showlegend": true,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "男"
         ],
         "xaxis": "x",
         "y": [
          71.66666666666667
         ],
         "yaxis": "y"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>开屏广告态度=不介意<br>%=%{y}<extra></extra>",
         "legendgroup": "男",
         "marker": {
          "color": "#EF553B",
          "pattern": {
           "shape": ""
          }
         },
         "name": "男",
         "offsetgroup": "男",
         "orientation": "v",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "男"
         ],
         "xaxis": "x2",
         "y": [
          25.833333333333336
         ],
         "yaxis": "y2"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>开屏广告态度=很喜欢<br>%=%{y}<extra></extra>",
         "legendgroup": "男",
         "marker": {
          "color": "#EF553B",
          "pattern": {
           "shape": ""
          }
         },
         "name": "男",
         "offsetgroup": "男",
         "orientation": "v",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "男"
         ],
         "xaxis": "x3",
         "y": [
          2.5
         ],
         "yaxis": "y3"
        }
       ],
       "layout": {
        "annotations": [
         {
          "font": {},
          "showarrow": false,
          "text": "开屏广告态度=很讨厌",
          "x": 0.15999999999999998,
          "xanchor": "center",
          "xref": "paper",
          "y": 1,
          "yanchor": "bottom",
          "yref": "paper"
         },
         {
          "font": {},
          "showarrow": false,
          "text": "开屏广告态度=不介意",
          "x": 0.49999999999999994,
          "xanchor": "center",
          "xref": "paper",
          "y": 1,
          "yanchor": "bottom",
          "yref": "paper"
         },
         {
          "font": {},
          "showarrow": false,
          "text": "开屏广告态度=很喜欢",
          "x": 0.8399999999999999,
          "xanchor": "center",
          "xref": "paper",
          "y": 1,
          "yanchor": "bottom",
          "yref": "paper"
         }
        ],
        "barmode": "relative",
        "legend": {
         "title": {
          "text": "性别"
         },
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "categoryarray": [
          "女",
          "男"
         ],
         "categoryorder": "array",
         "domain": [
          0,
          0.31999999999999995
         ],
         "title": {
          "text": "性别"
         }
        },
        "xaxis2": {
         "anchor": "y2",
         "categoryarray": [
          "女",
          "男"
         ],
         "categoryorder": "array",
         "domain": [
          0.33999999999999997,
          0.6599999999999999
         ],
         "matches": "x",
         "title": {
          "text": "性别"
         }
        },
        "xaxis3": {
         "anchor": "y3",
         "categoryarray": [
          "女",
          "男"
         ],
         "categoryorder": "array",
         "domain": [
          0.6799999999999999,
          0.9999999999999999
         ],
         "matches": "x",
         "title": {
          "text": "性别"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "%"
         }
        },
        "yaxis2": {
         "anchor": "x2",
         "domain": [
          0,
          1
         ],
         "matches": "y",
         "showticklabels": false
        },
        "yaxis3": {
         "anchor": "x3",
         "domain": [
          0,
          1
         ],
         "matches": "y",
         "showticklabels": false
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(\n",
    "    sun_df,  # 带绘图数据 \n",
    "    x=\"性别\",  # x轴\n",
    "    y=\"%\",  # y轴\n",
    "    color=\"性别\",\n",
    "    facet_col=\"开屏广告态度\",  # 列\n",
    "    category_orders={\"开屏广告态度\": [\"很讨厌\", \"不介意\", \"很喜欢\"]},\n",
    ")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'tau_y值为：0.000，该值属于极弱相关或不相关。'"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tau_y = mytools.goodmanKruska_tau_y(df, '性别', '开屏广告态度')\n",
    "F'tau_y值为：{tau_y:.3f}，该值属于{mytools.draw_on_corr(tau_y)}。'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [],
   "source": [
    "from scipy import stats\n",
    "x=df['性别']\n",
    "y=df['开屏广告态度']\n",
    "chi2, p, dof, ex = stats.chi2_contingency(pd.crosstab(x, y))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1.9834217310615847, 0.37094151677312714)"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chi2,p"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'p': 'p=0.371>0.05', 'tex_p': 'p>0.05', 'conclusion': '接收虚无假设，拒绝研究假设。'}"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mytools.p_result(p)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对XXX所做的调查发现，不同性别的大学生对待开屏广告的态度无显著性差异（p=0.371）。"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.8.10 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "9650cb4e16cdd4a8e8e2d128bf38d875813998db22a3c986335f89e0cb4d7bb2"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
